﻿<UserControl x:Class="WPFInterview.ControlTemplateQuestion"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    >
    <Grid>
        <StackPanel>
            <Button Template="{StaticResource ButtonTemplate}" Width="200" Height="50" Name="buttonTemplate" VerticalAlignment="Top" Content="Button Template">
            </Button>
            <Button x:Name="_exportTempalte" Click="_exportTempalte_Click">Export Template</Button>
            <FlowDocumentPageViewer>        
            <FlowDocument>
                <Paragraph>
                    WPF controls are designed to be lookless, which means that an element's functionality is
                    completely separate from the element's appearance.
                </Paragraph>
                    <Paragraph>
                        The ContentPresenter is essentially a placeholder for the "Content" property of teh Element.
                    </Paragraph>
                    <Paragraph>
                        Create a Template as a Resource, you simply have to define it in a Resource section and apply a Key.
                    </Paragraph>
                    <Paragraph>
                        The ControlTemplate object contains a collection of Trigger objects and you can 
                        add triggers here to provide visual interactivity just as you would in a style.
                    </Paragraph>
                    <Paragraph>
                        User controls, customer controls, and templates all allow you to create custom elements with customer appearances.
                    </Paragraph>
                    <List>
                        <ListItem>
                            <Paragraph>
                            If the functionality of one of the present controls matches the functionality you would like to 
                            incorporate then you should create a new template for that preexisting control.
                            </Paragraph>
                        </ListItem>
                        <ListItem>
                            <Paragraph>
                            If the functionality can be archived through a combination of preexisting controls and code, you should consider creating a user control
                            </Paragraph>
                        </ListItem>
                        <ListItem>
                            <Paragraph>
                            If no preexisting control or combination of controls can approach the functionality, then you should create a custom control.
                            </Paragraph>
                        </ListItem>
                    </List>
                    <Paragraph>
                        To take advantage of built-in databinding and change notification features in WPF, you should implement dependency properties.
                    </Paragraph>
                </FlowDocument>
            </FlowDocumentPageViewer>
        </StackPanel>
    </Grid>
</UserControl>
